﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UtilZ.Dotnet.Ex.Communication.Net.Telnet.Commands
{
    internal class TelnetCommandManager
    {
        private static readonly IReadOnlyDictionary<string, ITelnetCommand> _commandDic;


        static TelnetCommandManager()
        {
            _commandDic = new Dictionary<string, ITelnetCommand>()
            {
                { TelnetCommandConstant.CLEAR_HISTORY_COMMAND, new ClearCommandHistoryCommand()},
                { TelnetCommandConstant.CLEAR_SCREEN_COMMAND, new ClearScreenCommand()},
                { TelnetCommandConstant.EXIT, new ExitCommand()},
                { TelnetCommandConstant.GET_TELNET_INFO, new GetTelnetInfoCommand()},
                { TelnetCommandConstant.HELP, new HelpCommand()},

                { TelnetCommandConstant.SET_HISTORY_COMMAND_CAPCITY, new SetHistoryCommandCapcity()},
                { TelnetCommandConstant.ENCODING, new SettingEncodingCommand()},
                { TelnetCommandConstant.TERMINAL_OS_COMMAND, new TerminalOSCommand()},
            };
          

        }

        public static bool TryGetTelnetCommand(string command, out ITelnetCommand telnetCommand)
        {
            return _commandDic.TryGetValue(command, out telnetCommand);
        }
    }
}
